//package com.metaverse.backend.mq;
//
//import cn.hutool.core.date.DateUtil;
//import com.metaverse.backend.config.MqConstant;
//import com.metaverse.backend.domain.LiveLike;
//import com.metaverse.backend.repo.LiveLikeRepo;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.stereotype.Component;
//
//import java.time.LocalDateTime;
//import java.util.List;
//
//@AllArgsConstructor
//@Slf4j
//@RocketMQMessageListener(consumerGroup= MqConstant.ROOM_DATA_LIVE_LIKE,
//        topic= MqConstant.ROOM_DATA_LIVE_LIKE)
//@Component
//public class LiveLikeDataListener implements RocketMQListener<List<LiveLike>> {
//
//    private LiveLikeRepo liveLikeRepo;
//
//
//    @Override
//    public void onMessage(List<LiveLike> message) {
//        log.debug("收到点赞数据：" + message);
//        message.forEach(item -> {
//            if(item.getTimestamp() != null){
//                //转换发生时间
//                LocalDateTime happenTime = DateUtil.date(item.getTimestamp()).toLocalDateTime();
//                item.setHappenTime(happenTime);
//            }
//        });
//
//        liveLikeRepo.saveAll(message);
//    }
//
//
//}
